<?php

namespace Modules\Admin\Http\Requests;

use Illuminate\Foundation\Http\FormRequest;

class RoleRequest extends FormRequest
{
    /**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
    public function rules()
    {
    	$id=$this->route('role');
        return [
            'name'=>'required|unique:roles,name,'.$id,
			'title'=>'required|unique:roles,title,'.$id
        ];
    }
	public function messages ()
	{
		return [
			'name.required'=>'角色名不能为空',
			'name.unique'=>'角色明已存在',
			'title.unique'=>'角色标识已存在',
			'title.required'=>'角色标识不能为空'
		];
	}

	/**
     * Determine if the user is authorized to make this request.
     *
     * @return bool
     */
    public function authorize()
    {
        return true;
    }
}
